Fix Clang 22 warnings part 2#7309
Closed
KonstaT wants to merge 1 commit intoraspberrypi:rpi-6.18.yfrom
Closed
Conversation
* Fixes build with Clang.
In file included from drivers/pwm/pwm-pio-rp1.c:20:
include/linux/pio_rp1.h:283:42: error: implicit conversion from 'uint' (aka 'unsigned int') to 'uint16_t' (aka 'unsigned short') changes value from 4294967295 to 65535 [-Werror,-Wconstant-conversion]
283 | args.origin = (program->origin == -1) ? PIO_ORIGIN_ANY : program->origin;
| ~ ^~~~~~~~~~~~~~
include/linux/pio_rp1.h:44:27: note: expanded from macro 'PIO_ORIGIN_ANY'
44 | #define PIO_ORIGIN_ANY ((uint)(~0))
| ^~~~~~~~~~
include/linux/pio_rp1.h:312:42: error: implicit conversion from 'uint' (aka 'unsigned int') to 'uint16_t' (aka 'unsigned short') changes value from 4294967295 to 65535 [-Werror,-Wconstant-conversion]
312 | args.origin = (program->origin == -1) ? PIO_ORIGIN_ANY : program->origin;
| ~ ^~~~~~~~~~~~~~
include/linux/pio_rp1.h:44:27: note: expanded from macro 'PIO_ORIGIN_ANY'
44 | #define PIO_ORIGIN_ANY ((uint)(~0))
| ^~~~~~~~~~
2 errors generated.
Merged
pelwell
added a commit
that referenced
this pull request
Apr 10, 2026
Avoid some compiler warnings by adding explicit narrowing casts. See: #7309 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Contributor
|
See #7311 for an alternative fix. I didn't want to change the define because the error value is part of the ABI. |
Author
|
Yeah, #7311 works for me with Clang 22 so I'll close this one. |
pelwell
added a commit
that referenced
this pull request
Apr 10, 2026
Avoid some compiler warnings by adding explicit narrowing casts. See: #7309 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Contributor
|
Thanks! |
pelwell
added a commit
that referenced
this pull request
Apr 10, 2026
Avoid some compiler warnings by adding explicit narrowing casts. See: #7309 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pelwell
added a commit
that referenced
this pull request
Apr 10, 2026
Avoid some compiler warnings by adding explicit narrowing casts. See: #7309 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pelwell
added a commit
that referenced
this pull request
Apr 10, 2026
Avoid some compiler warnings by adding explicit narrowing casts. See: #7309 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split one patch from #7299.